package com.jsbj.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;

@Getter
@AllArgsConstructor
public enum QualityPushTypeEnum {
    TASK_MANAGER("YZLSCGL", "TASK_MANAGER", "预制梁生产管理-审批", ""),
    TASK_MANAGER_BH("TZTS","TASK_MANAGER_BH", "预制梁生产管理-驳回", "")
    ;

    private String menuCode;
    private String pushType;
    private String moduleDesc;
    private String modulePath;

    /**
     * 根据菜单编码获取推送类型
     * @param menuCode 值
     * @return 名称集合
     */
    public static List<String> getPushTypeByMenuCode(String menuCode)
    {
        List<String> pushTypeList = new ArrayList<>();
        if (menuCode == null)
        {
            return null;
        }

        for (QualityPushTypeEnum e : QualityPushTypeEnum.toEnumSet())
        {
            if (e.getMenuCode().equals(menuCode))
            {
                String that = e.getPushType();
                pushTypeList.add(that);
            }
        }
        return pushTypeList;
    }

    /**
     * 根据推送类型获取菜单编码
     * @param pushType 值
     * @return 名称集合
     */
    public static String getMenuCodeByPushType(String pushType)
    {
        String menuCode = "";

        for (QualityPushTypeEnum e : QualityPushTypeEnum.toEnumSet())
        {
            if (e.getPushType().equals(pushType))
            {
                menuCode = e.getMenuCode();
            }
        }
        return menuCode;
    }

    public static EnumSet<QualityPushTypeEnum> toEnumSet()
    {
        return EnumSet.allOf(QualityPushTypeEnum.class);
    }


}
